//
//  BaseTableViewController.swift
//  DSWeibo
//
//  Created by liuzhu on 2018/10/30.
//  Copyright © 2018 liuzhu. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorViewDelegate {
    @objc func loginBtnWillClick() {
        //弹出登录界面
        let oauthVC = OAuthViewController()
        let nav = UINavigationController(rootViewController: oauthVC)
        present(nav, animated: true, completion: nil)
    }
    
    @objc func registerBtnWillClick() {
     
    }
    
    var userLogin = UserAccount.userLogin()
    override func loadView() {
        userLogin ? super.loadView():setupVisitorView()
    }
    
    private func setupVisitorView(){
        let customView = VisitorView()
        customView.delegate = self
        view = customView
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItem.Style.plain, target: self, action: #selector(registerBtnWillClick))
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItem.Style.plain, target: self, action: #selector(loginBtnWillClick))
    }
    
    
}
